package cn.lyvust.work.exam02;

/**
 * Description:
 * date: 2021-5-11 22:41
 *
 * @author Guo_guo
 * @since JDK 1.8
 */
public class T2 {
    public static void main(String[] args) {
        //创建线程对象
        Mythread r = new Mythread();
        Thread thread1 = new Thread(r);
        Thread thread2 = new Thread(r);
        //启动线程
        thread2.start();
        thread1.start();
    }
}
//使用实现Runnable接口的方式创建线程
class Mythread implements Runnable{
    public void run(){
        for(int i=1;i<=20;i++){
            System.out.println(i+".你好，来自线程"+Thread.currentThread().getName());
        }
    }
}
